package edu.zut.software.identity.Repository;

import edu.zut.software.identity.domain.Student;
import edu.zut.software.identity.domain.Teacher;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Repository
public interface TeacherRepository extends JpaRepository<Teacher,Object>, JpaSpecificationExecutor<Teacher> {
    @Query(value = "select t.time as genre,COUNT(t.time) as sold\n" +
            "from zut.teacher t\n" +
            "group by t.time\n",nativeQuery = true)
    List<Map<Date, Integer>> getCount();
    @Override
    <S extends Teacher> Page<S> findAll(Example<S> example, Pageable pageable);
}
